package com.sskj.common.encrypt;

import android.util.Base64;

import java.io.UnsupportedEncodingException;

public class Base64Utils {
    public static byte[] encode(String str) {
        try {
            return Base64.encode(str.getBytes("UTF-8"), Base64.NO_WRAP);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    }


    public static byte[] decode(String str) {
        try {
            return Base64.decode(str.getBytes("UTF-8"), Base64.NO_WRAP);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    }


    public static byte[] decode(byte[] str) {
        return Base64.decode(str, Base64.NO_WRAP);
    }

    public static byte[] encode(byte[] str) {
        return Base64.encode(str, Base64.NO_WRAP);
    }
}
